UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'msxQ3c8Uro4gEIVb7n8TALziV53CmkRBDiiZnln6X/o='
WHERE
key_id = '83c6ebdee9d7e0b195ac37906447c1df96d3531318affea43f45658963755109'
AND (
token = 'msxQ3c8Uro4gEIVb7n8TALziV53CmkRBDiiZnln6X/o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)