UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qFYDgPnLHNod+sK3dcjhBtjohsOQ0aB4sRJlKv+Q77Q=' 
WHERE 
  key_id = '1a8228313118efde8dd2a0060fcdff004007e97ac97cf227af5ff866d62916b9' 
  AND (
    token = 'qFYDgPnLHNod+sK3dcjhBtjohsOQ0aB4sRJlKv+Q77Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032