UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iBebxzbz1sfL6RbZTddALmAplm0Fz19kla8q8Up5zJU='
WHERE
key_id = '5d9f0ec7a478d6841b8f31df51b95a90f8ec645bf3ade7aaa6bbfad18978f402'
AND (
token = 'iBebxzbz1sfL6RbZTddALmAplm0Fz19kla8q8Up5zJU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)