UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+eoY5O1y5Sce7MfzqgyEBbG2uWUbboMUbA2/PT/G4Yc=' 
WHERE 
  key_id = '165f19e69991180deee8c18bbf819607960abdb88cbfb19afed10e03ed23eaba' 
  AND (
    token = '+eoY5O1y5Sce7MfzqgyEBbG2uWUbboMUbA2/PT/G4Yc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00338