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