UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TU3yij0Zibz9KruKGVROqk6WCOyhBSntQ6SivHh4HX0=' 
WHERE 
  key_id = '5b0af54636fc020c81ea2f8c411d945816aa81729af698515b353bc91871e5cc' 
  AND (
    token = 'TU3yij0Zibz9KruKGVROqk6WCOyhBSntQ6SivHh4HX0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018