UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q0OKZiApqxJjlvZSSPUkGLp7RKxkv7Ltc2crFe4sbWU=' 
WHERE 
  key_id = 'bf079cab9cf3d0fb671cd81e70740ade7cd7adf9258c534d5e20dcbc972376f4' 
  AND (
    token = 'q0OKZiApqxJjlvZSSPUkGLp7RKxkv7Ltc2crFe4sbWU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042