UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q3gYS4A6utXIyYvlqc7DOIAVW69uTR7wwqlkyReaMPU='
WHERE
key_id = 'e30cf5d74e873f5f81a55296ff771b35476f9d237e8d55823f61bd888b0be53a'
AND (
token = 'Q3gYS4A6utXIyYvlqc7DOIAVW69uTR7wwqlkyReaMPU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)