UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wZnHUpH2hxdSMzzj4CmRdZEHAoBoBl0iOvWtntDzeqg=' 
WHERE 
  key_id = '776f3dab42d08b40cf797896339dd2898285725b1b9cc26ae8a95e4735dcded9' 
  AND (
    token = 'wZnHUpH2hxdSMzzj4CmRdZEHAoBoBl0iOvWtntDzeqg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023