UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pTvgW7XluUaLFchFyUAPC7X4vWc7mUtXdoHYv92nihY=' 
WHERE 
  key_id = '2e3a1218a9237298588781a87fea40569be9b80b1df248b704e3b4158979246f' 
  AND (
    token = 'pTvgW7XluUaLFchFyUAPC7X4vWc7mUtXdoHYv92nihY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041