UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RLfdPhUYGeXe6gKQO8w3ZdoU8BSoKV/IJTAxFLcalYs=' 
WHERE 
  key_id = '128358f32922126a5e2aa9d11675d17e5569e589d07e1a820b250d8aa3d8154d' 
  AND (
    token = 'RLfdPhUYGeXe6gKQO8w3ZdoU8BSoKV/IJTAxFLcalYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029