UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xbsR3EbmRpYjsZ89M4FskTodtHWSatU2l54BVDG7V5g='
WHERE
key_id = 'bc7f80e23ba846d162bede8b6861af4dc0f3d9f2dad3d9d0edb0f84fe4d78881'
AND (
token = 'xbsR3EbmRpYjsZ89M4FskTodtHWSatU2l54BVDG7V5g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)