UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hHtyxR4PhZpjKnPURiAtiTaUx7C408zY3KyZmw95fGM=' 
WHERE 
  key_id = '7f13768232aa862c84664ca19315b2b26e0596f74794b122472593f94de632ac' 
  AND (
    token = 'hHtyxR4PhZpjKnPURiAtiTaUx7C408zY3KyZmw95fGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035