UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B+kqmjeFMMCLi6ecLeNS8/6HCOclV6994+fBW6wGpcc='
WHERE
key_id = '516d67ad159e340321c17ddcd8e5fcc9272ec5fa00e9611ca885f4c9a74bfa61'
AND (
token = 'B+kqmjeFMMCLi6ecLeNS8/6HCOclV6994+fBW6wGpcc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)