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