UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A6w7m86TYJ0HsihzW50Cdczs4z958W774OAIFC+xrAw='
WHERE
key_id = '365838bd6c05bfe5e2ba8b64a349715b7a9606829d2ca358f2b66ec16bed3df6'
AND (
token = 'A6w7m86TYJ0HsihzW50Cdczs4z958W774OAIFC+xrAw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)