UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6vb4YcxWTAz3X9MLLJ4p5lMgP1eVFiGYUWga1z44OUE='
WHERE
key_id = 'f845e13ae49461f190c7947c30bbbb7caef41e2c0d75991d8a7ba16d1c68cbe3'
AND (
token = '6vb4YcxWTAz3X9MLLJ4p5lMgP1eVFiGYUWga1z44OUE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)