UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k+Pqov3HbJ0UVvU8/eNzG/TkTBulaa6liD6v4BCCjwo=' 
WHERE 
  key_id = '3b73300c6f316829bb89d05051847151a820fddda631a55e6414baedeebaa383' 
  AND (
    token = 'k+Pqov3HbJ0UVvU8/eNzG/TkTBulaa6liD6v4BCCjwo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039