UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y1Zqx24Hja7zDuYKbgNUT0q+Ao7ZhAoRIjsgLM/BAG4=' 
WHERE 
  key_id = '93936cf7866472c238f880909c92c24f131e3505875a42b6837283fb9db3a375' 
  AND (
    token = 'y1Zqx24Hja7zDuYKbgNUT0q+Ao7ZhAoRIjsgLM/BAG4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027