UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X0b4dOkH0lO8Dc7Cko+25dty7gbN00/ZONug80glcTk='
WHERE
key_id = '297f4f4676c08fe6141715e1c0e8edd1f731dba3d3735158c1d54bd2c0c50293'
AND (
token = 'X0b4dOkH0lO8Dc7Cko+25dty7gbN00/ZONug80glcTk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)