UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dylTnTE8vlWgx8JmN3mqFuWPFTHPuCSbhUDBRF3Vy40='
WHERE
key_id = '349617645b868a98e52213332933622f6079d8f09ea8f2bfc64fb27400e65d1b'
AND (
token = 'dylTnTE8vlWgx8JmN3mqFuWPFTHPuCSbhUDBRF3Vy40='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)