UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nO0xkg/Wd1AVM1SMELkiGuM2uc0cA6+Mb2c29wfT1Dw=' 
WHERE 
  key_id = '2d3214995e760c628b7cad99d7d2fda9d8b3893a85655bdb2f803694c7d0d71c' 
  AND (
    token = 'nO0xkg/Wd1AVM1SMELkiGuM2uc0cA6+Mb2c29wfT1Dw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018