UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mbY2kMHCH81fUAr/sq2fOlzfirPQ6xXaOY9GurFX+9Q=' 
WHERE 
  key_id = '72daa21b2850489bda442da7d399f3fd87921915e9283e6b7726642081408be6' 
  AND (
    token = 'mbY2kMHCH81fUAr/sq2fOlzfirPQ6xXaOY9GurFX+9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048