UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ef4hDFNjhCaKIVDQjYO5wt+owUDi8wEKRIIarMftilw=' 
WHERE 
  key_id = '47cf45522a049fe15fda955da84ad39ec4dafea09388ee3697825c3d875f41f5' 
  AND (
    token = 'ef4hDFNjhCaKIVDQjYO5wt+owUDi8wEKRIIarMftilw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047