UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0tcqgqBjKk8SaLZ+Q0bZdT8iJJd4U2kaxh3jmaQe5Q4='
WHERE
key_id = '344e9aa034ca0cb1f68d6c8a8f6b2f2ff62a6a3ffeb1d7d0ac4d3b2365009a70'
AND (
token = '0tcqgqBjKk8SaLZ+Q0bZdT8iJJd4U2kaxh3jmaQe5Q4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)