UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l39ex0dcHdAFiWpNs29hAPXLsdp73aRBk+mA56C7hfk='
WHERE
key_id = 'd80a017d755f1a49bee3f4bf56fbec4636b522c5ea785a3b3418be9553b5dad0'
AND (
token = 'l39ex0dcHdAFiWpNs29hAPXLsdp73aRBk+mA56C7hfk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)