UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LLB85U/qHM7ZRyHrom54z2RZ+VvYi76otlRV4DKYNrg=' 
WHERE 
  key_id = 'e259a8cbc58c63f0db3a19a16e8c0e4e4390becc5f73d84e288c6feb3426d99f' 
  AND (
    token = 'LLB85U/qHM7ZRyHrom54z2RZ+VvYi76otlRV4DKYNrg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046