UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5rDfeiq5emrZJTQ4bq54l04r6M1B7JWhJIGvtZNINGQ=' 
WHERE 
  key_id = '817d062da6f5122af9726c921cdf5ea3527ed83aa8bb24c770e9e1facadce963' 
  AND (
    token = '5rDfeiq5emrZJTQ4bq54l04r6M1B7JWhJIGvtZNINGQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031