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