UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iLNOpB8Xy9JKkJ4CGsMIvZuSMp/ReyJcmRDDJI2Iy3A='
WHERE
key_id = 'cb03c8db39a00aab01d172ce3af6a226508875a0082a637f7ef804235fd27bde'
AND (
token = 'iLNOpB8Xy9JKkJ4CGsMIvZuSMp/ReyJcmRDDJI2Iy3A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)