UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R5KOK1tAWV/fLDJyoqm4YLofnuxoSNXXdejNHslrvMc=' 
WHERE 
  key_id = '1871b98537bbb2d6668397e286d73f1d45359a38032e4967ce3397de772bd448' 
  AND (
    token = 'R5KOK1tAWV/fLDJyoqm4YLofnuxoSNXXdejNHslrvMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061