UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P7xG+Rl5LJxdX+AfTKOip7CuTGpgTw5PFDijAchgVys=' 
WHERE 
  key_id = '754d90cfd25d839d4ba6b7894c8df27af7679b4e451bf37403adebe8dfcc3fc2' 
  AND (
    token = 'P7xG+Rl5LJxdX+AfTKOip7CuTGpgTw5PFDijAchgVys=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037